package com.wollo.mapper;

import com.wollo.domain.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
    //根据账户查询用户信息
    @Select("select * from t_user where username=#{username} or phone=#{username} or email=#{username}")
    User selectUserInfoByUserNameMapper(String username);
    //注册学生
    @Insert("insert into t_user(username,pwd,cid) values (#{username},#{pwd},#{cid})")
    void insertUser(User user);
    //完善学生信息
    @Update("update t_user set" +
            "gender=#{gender}" +//有些信息让用户直接提供身份证，判断赋值进行添加
            "age=#{age}" +
            "email=#{email}" +
            "phone=#{phone}" +
            "realname=#{realname}" +
            "address=#{address}" +
            "money=#{money}" +
            "workposition=#{workposition}" +
            "education=#{education}" +
            "school=#{school}" +
            "status=#{status}" +
            "pstatus=#{pstatus}" +
            "cid=#{cid}" +
            "where uid=#{uid}")
    Integer userUpdate(User user);
}
